#if !defined(AFX_FACTORYTEST_H__BF01CF81_2A1C_437D_B6B6_AD9E4A1075A6__INCLUDED_)
#define AFX_FACTORYTEST_H__BF01CF81_2A1C_437D_B6B6_AD9E4A1075A6__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// FactoryTest.h : header file
//
#include "ProgDlg.h"
#include "InfoFrame.h"
#include <afxtempl.h>
/////////////////////////////////////////////////////////////////////////////
// CFactoryTest dialog
#define MAX_SUPPORT_COL  17
typedef struct tag_script_tbl
{
    CString strs[MAX_SUPPORT_COL];
    long    vl[MAX_SUPPORT_COL];
    INT     vperct[MAX_SUPPORT_COL];
}SCRIPT_TBL;

typedef struct tag_testitem
{
    int  Cmd;
    int  WaitEvent;
    int  TestTimes;
    int  GroupRepeat;
    int  GroupRow0;
    int  WaitUi;
    CArray <INT, INT> TimeCmd;    
}TEST_ITEM;

typedef enum  te_test_state
{
    TEST_QUEUE,
    TEST_GROUT,
    TESTING,
    TEST_PASS,
    TEST_FAIL,
    TEST_STOP,
    TEST_SKIP
}TEST_STATE;


class CFactoryTest : public CDialog
{
// Construction
public:
	void OnWizard();
	CFactoryTest(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
	//{{AFX_DATA(CFactoryTest)
	enum { IDD = IDD_FACTORYTEST_DIALOG };
	CListCtrl	m_oMsg;
	CListCtrl	m_List;
	CString	m_strScriptFile;
	//}}AFX_DATA


// Overrides
    CImageList m_imageList; 
    CArray<SCRIPT_TBL,SCRIPT_TBL> m_TestTbl;
    void CleanUpRlt();
    BOOL DoNextTestItem();
    BOOL DoAudioOp(SCRIPT_TBL &tbl);
    INT FindSendCmd(CString &strCmd, CString &strParm, BOOL bSendCmd = TRUE);
    void SetTestState(TEST_STATE state);
    int  m_nCurStep;
    int  m_nTimeout ;
    int  m_nTesting;
	unsigned int m_snIndex;
	int dbg;
	unsigned __int64 m_snBase;
	CString m_strIniPath;
	void UpdateIni();



    TEST_ITEM  m_CurTest;
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CFactoryTest)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
    void PrepareTest();
    void EndTest();
    BOOL WaitUi(void);
protected:

	// Generated message map functions
	//{{AFX_MSG(CFactoryTest)
	afx_msg void OnBtnTesting();
	afx_msg void OnBtnBrowsScript();
	virtual BOOL OnInitDialog();
	afx_msg void OnDestroy();
	afx_msg void OnBtnLoadScript();
	afx_msg void OnTimer(UINT nIDEvent);
    afx_msg LONG OnUsbEvent(WPARAM wParam, LPARAM lParam);
	//}}AFX_MSG
    afx_msg LRESULT OnPhoneAudioState(WPARAM wParam, LPARAM lParam);
    afx_msg LRESULT OnMciMessage(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_FACTORYTEST_H__BF01CF81_2A1C_437D_B6B6_AD9E4A1075A6__INCLUDED_)
